home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / MultiSpinnerUI.java < prev    next >
Text File  |  1998-06-30  |  4KB  |  122 lines

  1. /*
  2.  * @(#)MultiSpinnerUI.java    1.10 98/02/02
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.multi;
  22.  
  23. import java.util.Vector;
  24. import java.io.Serializable;
  25. import com.sun.java.swing.*;
  26. import java.awt.*;
  27. import com.sun.java.swing.plaf.*;
  28.  
  29. /**
  30.  * MultiSpinnerUI implementation
  31.  * <p>
  32.  * Warning: serialized objects of this class will not be compatible with
  33.  * future swing releases.  The current serialization support is appropriate
  34.  * for short term storage or RMI between Swing1.0 applications.  It will
  35.  * not be possible to load serialized Swing1.0 objects with future releases
  36.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  37.  * baseline for the serialized form of Swing objects.
  38.  *
  39.  * @version 1.10 02/02/98
  40.  * @author Willie Walker
  41.  */
  42. public class MultiSpinnerUI extends SpinnerUI 
  43.     implements Serializable {
  44.  
  45.     /**
  46.      * The Vector containing the real UI's.  This is populated 
  47.      * in the call to createUI, and can be obtained by calling
  48.      * getUIs.  The first element is guaranteed to the real UI 
  49.      * obtained from the default look and feel.
  50.      */
  51.     protected Vector uis = new Vector();
  52.  
  53. ////////////////////
  54. // Common UI methods
  55. ////////////////////
  56.  
  57.     public static ComponentUI createUI(JComponent c) {
  58.         ComponentUI mui = new MultiSpinnerUI();
  59.         return MultiLookAndFeel.createUIs(mui,
  60.                                           ((MultiSpinnerUI) mui).uis,
  61.                                           c);
  62.     }
  63.  
  64.     /**
  65.      * Return the list of UI's associated with this multiplexing UI.  This 
  66.      * allows processing of the UI's by an application aware of multiplexing 
  67.      * UI's on components.
  68.      */
  69.     public ComponentUI[] getUIs() {
  70.         return MultiLookAndFeel.uisToArray(uis);
  71.     }
  72.  
  73. //////////////////////
  74. // ComponentUI methods
  75. //////////////////////
  76.  
  77.     public void installUI(JComponent c) {
  78.         for (int i = 0; i < uis.size(); i++) {
  79.             ((ComponentUI) (uis.elementAt(i))).installUI(c);
  80.         }
  81.     }
  82.  
  83.     public void uninstallUI(JComponent c) {
  84.         for (int i = 0; i < uis.size(); i++) {
  85.             ((ComponentUI) (uis.elementAt(i))).uninstallUI(c);
  86.         }
  87.     }
  88.   
  89.     public void paint(Graphics g, JComponent c) {
  90.         for (int i = 0; i < uis.size(); i++) {
  91.             ((ComponentUI) (uis.elementAt(i))).paint(g,c);
  92.         }
  93.     }
  94.       
  95.     public void update(Graphics g, JComponent c) {
  96.         for (int i = 0; i < uis.size(); i++) {
  97.             ((ComponentUI) (uis.elementAt(i))).update(g,c);
  98.         }
  99.     }
  100.  
  101.     public Dimension getPreferredSize(JComponent c) {
  102.         return ((ComponentUI) (uis.elementAt(0))).getPreferredSize(c);
  103.     }
  104.  
  105.     public Dimension getMinimumSize(JComponent c) {
  106.         return ((ComponentUI) (uis.elementAt(0))).getMinimumSize(c);
  107.     }
  108.  
  109.     public Dimension getMaximumSize(JComponent c) {
  110.         return ((ComponentUI) (uis.elementAt(0))).getMaximumSize(c);
  111.     }
  112.  
  113.     public boolean contains(JComponent c, int x, int y) {
  114.         return ((ComponentUI) (uis.elementAt(0))).contains(c,x,y);
  115.     }
  116.  
  117. ////////////////////
  118. // SpinnerUI methods
  119. ////////////////////
  120.  
  121. }
  122.